package com.zr.controller.finance;


import com.zr.service.finance.FinanceStatementService;
import com.zr.utils.AjaxResult;
import com.zr.vo.finance.FinanceStatement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/finance/statement")
public class FinanceStatementController {

    //service实现类
    @Autowired
    private FinanceStatementService financeStatementService;

    /**
     * @author wanglu
     * 查询对账单
     * @param financeStatement
     * @return
     */
    @PostMapping("/getList")
    public AjaxResult getList(@RequestBody FinanceStatement financeStatement){
        return AjaxResult.success(200,"查询成功",financeStatementService.getList(financeStatement));
    }

    /**
     * @author wanglu
     * 删除对账单
     * @param financeStatement
     * @return
     */
    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody FinanceStatement financeStatement){
        return AjaxResult.success(200,"删除成功",financeStatementService.remove(financeStatement));
    }

    /**
     * @author wanglu
     * 新增或修改对账单
     * @param financeStatement
     * @return
     */
    @PostMapping("/add")
    public AjaxResult add(@RequestBody FinanceStatement financeStatement){
        return AjaxResult.success(200,"保存成功",financeStatementService.handler(financeStatement));

    }

    /**
     * @author wanglu
     * 确认归档对账
     * @param financeStatement
     * @return
     */
    @PostMapping("/confirm")
    public AjaxResult confirm(@RequestBody FinanceStatement financeStatement){
        return AjaxResult.success(200,"归档成功",financeStatementService.handler(financeStatement));

    }





}
